//
//  PersonCenterCell.m
//  WanLian
//
//  Created by muzhuang on 2018/9/5.
//  Copyright © 2018年 wanlian. All rights reserved.
//

#import "PersonCenterCell.h"

@implementation PersonCenterCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        UIImage *image = [UIImage imageNamed:@"my_router"];
//        _ivHead = [[UIImageView alloc] initWithFrame:CGRectMake(WLScaleX(20), (self.contentView.bounds.size.height-image.size.height)/2.0, image.size.width, image.size.height)];
//        [self.contentView addSubview:_ivHead];
//
//        _labTitle = [[UILabel alloc] initWith];
//        WLWkSelf
//        [_ivHead mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.
//        }];
        [self ivHead];
        [self labTitle];
        [self vMsgTip];
        [self labDetail];
    }
    return self;
}

- (UIImageView *)ivHead
{
    if (!_ivHead) {
        _ivHead = [[UIImageView alloc] init];
        [self.contentView addSubview:_ivHead];
    }
    return _ivHead;
}

- (UILabel *)labTitle
{
    if (!_labTitle) {
        _labTitle = [[UILabel alloc] init];
        _labDetail.font = [WLCommonTool fontTypePingFangSCMedium:17];
        _labTitle.textColor = wlBlackColor;
        [self.contentView addSubview:_labTitle];
    }
    return _labTitle;
}

- (UILabel *)labDetail{
    if (!_labDetail) {
        _labDetail = [[UILabel alloc] init];
        _labDetail.textColor = wlLightTextColor;
        _labDetail.font = [UIFont systemFontOfSize:14];
        _labDetail.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_labDetail];
    }
    return _labDetail;
}

- (UIView *)vMsgTip
{
    if (!_vMsgTip) {
        _vMsgTip = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 8)];
        _vMsgTip.backgroundColor = wlUIColorRGB(0xE71A4F);
        _vMsgTip.layer.cornerRadius = 4.f;
        _vMsgTip.layer.masksToBounds = YES;
        _vMsgTip.hidden = YES;
        [self.contentView addSubview:_vMsgTip];
    }
    return _vMsgTip;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    WLWkSelf
//    UIImage *image = [UIImage imageNamed:@"my_router"];
    [self.ivHead mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf.contentView.mas_left).offset(WLScaleX(15));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(24, 25));
    }];
    
    [self.labTitle mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf.ivHead.mas_right).offset(WLScaleX(15));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(120, 25));
    }];
    
    [self.labDetail mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(weakSelf.mas_right).offset(WLScaleX(-34));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(120, 25));
    }];
    
    [self.vMsgTip mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(weakSelf.mas_right).offset(WLScaleX(-34));
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(WLScaleX(8), WLScaleX(8)));
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
